package com.laf.manage.controller.admin;

import com.laf.common.core.domain.R;
import com.laf.manage.domain.dto.StatusCountDTO;
import com.laf.manage.service.IDynamicService;
import com.laf.manage.service.ILostItemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@Api(tags = "统计接口管理")
@RequestMapping("/admin/statistics")
@RestController
@RequiredArgsConstructor
public class StatisticsController {

    private final ILostItemService lostItemService;


    private final IDynamicService dynamicService;

    // 统计各种状态的失物数据
    @GetMapping("/lost/count")
    @ApiOperation("失物状态统计")
    public R<List<StatusCountDTO>> lostCount() {
        List<StatusCountDTO> result = lostItemService.lostCount();
        return R.ok(result);
    }

    // 统计各种状态的动态数据
    @GetMapping("/dynamic/count")
    @ApiOperation("动态状态统计")
    public R<List<StatusCountDTO>> dynamicCount() {
        return R.ok(dynamicService.dynamicCount());
    }

}
